home *** CD-ROM | disk | FTP | other *** search
/ Wildcat Files 2 / The Wildcat Files 2 (Arsenal Computer).ISO / qm-util / mailrun.scr < prev    next >
Text File  |  1994-04-02  |  8KB  |  163 lines

  1. ; This script will make an unattended mail run to pick up Tomcat mail and send
  2. ; any new mail waiting to be sent.  Make sure you edit DIALTXT, NAME, MAXTRIES,
  3. ; and TCLOGOFF in the DEFINITIONS section (leave UDONE and DDONE alone) to
  4. ; meet your requirements!
  5. ;
  6. ; IMPORTANT: You must have HotKeys turned off and Expert mode turned on in
  7. ; your user profile on the BBS, and also make sure the packet name is defined
  8. ; in the FON book entry for the system you will be calling before using this
  9. ; script.
  10. ;
  11. ; Modified from the script listed in the QmodemPro 1.00 manual.  Feel free
  12. ; to make any modifications you wish.  If you make it better, then share it
  13. ; with everyone else!
  14. ;
  15.  
  16. TurnOn  8_BIT
  17. TurnOff LINEFEED
  18. TurnOff XON/XOFF
  19. TurnOff NOISE
  20. TurnOff MUSIC
  21. TurnOn  SCROLL
  22. TurnOff PRINT
  23. TurnOff ECHO
  24. Capture MAILRUN.CAP
  25. Log     MAILRUN.LOG
  26. ;
  27. ; ------------------------ DEFINITIONS -------------------------
  28. ;
  29. String  NAME UDONE DDONE DOOR MAXTRIES FONTXT TCLOGOFF DIALTXT
  30. Assign  DIALTXT "My Hub"                ; unique text string from FON file
  31. Assign  NAME    "!Logon Name PASSWORD"  ; Name and Password on BBS
  32. Assign  UDONE   N                       ; Upload done?
  33. Assign  DDONE   N                       ; Download done?
  34. Assign  MAXTRIES 5                      ; Maximum attempts to connect
  35. Assign  TCLOGOFF N                      ; set this to Y if you have logoff
  36.                                         ; after upload set to Y in Tomcat,
  37.                                         ; N if you do not
  38. ;
  39. ; --------------------- END DEFINITIONS ------------------------
  40. ;
  41.  
  42. Restart:                                ; Go here if the connection gets
  43.                                         ; broken then stamp log
  44. Stamp NO CARRIER detected, restarting script
  45.  
  46. ; Notes:
  47. ; The DIAL command uses the ability to call a specific number, without
  48. ; knowing the exact position in the .FON file.  The example DIALTXT set up
  49. ; in this script will search the .FON file for the text "MSI HQ".  By using
  50. ; the Text dial option and specifying this, it will dial this number even
  51. ; if the FON book is sorted.  Note the 'T' prefix in the DIAL line below...
  52.  
  53. ;-----
  54. ; Dial section starts here
  55. ;-----
  56. Decr    MAXTRIES                        ; decrement the counter
  57. If      "$MAXTRIES" = "0" TooManyTries  ; if none left goto TooManyTries
  58. If      $ONLINE SkipDial                ; skip the dial if online already
  59. Dial    "T$DIALTXT"                     ; dial selected entry
  60. SkipDial:
  61. TimeOut 1200 OutOfTime                  ; set Waitfor timeout to 1200 seconds
  62. Goto    Top                             ; jump to start of main body
  63. OutOfTime:                              ; come here if something times out
  64. Hangup                                  ; hang up the phone
  65. Delay   5000                            ; wait 5 seconds
  66. Hangup                                  ; hang up again (just in case)
  67. Delay   5000                            ; wait 5 seconds
  68. Goto    Restart                         ; start over again
  69.  
  70. ;-----
  71. ; Main Body starts here
  72. ;-----
  73. Top:                                    ; label for main body of script
  74. When    "NO CARRIER" Restart            ; goto label restart if fails
  75. When    "[S]top?" "S^M"                 ; send S Enter at any pause prompt
  76. When    "[L]ist mail, or [C]on" "C^M"   ; send C Enter at mail notice
  77. Waitfor "irst name"                     ; wait for first name prompt
  78. Delay   100                             ; delay .1 second
  79. Send    "$NAME^M"                       ; send text from Define section
  80. Waitfor "TOMCAT MENU"                   ; wait for the Tomcat menu prompt
  81.  
  82. ;-----
  83. CmdLoop:                                ; label for command loop
  84. If      "$DDONE" = "N" DoDownload       ; download not done, do it
  85. If      "$UDONE" = "N" DoUpload         ; upload not done, do it
  86. Goto AllDoneN                           ; only if both of above are done
  87.  
  88. ;-----
  89. DoDownload:                             ; label for download section
  90. When    "nothing found to d" DownloadOK ; go to label if no msgs to download
  91. Send    "^M"                            ; send ENTER for check
  92. Waitfor "TOMCAT MENU"                   ; wait for menu again
  93. Delay   2000                            ; wait 2 seconds
  94. Send    "D^M"                           ; send D ENTER for download
  95. Waitfor "receive this packet"           ; wait until packet is ready
  96. Delay   100                             ; delay .1 second
  97. Send    "Y^M"                           ; answer Y ENTER
  98. Waitfor "$PACKET.QWK"                   ; wait until it's ready to send
  99. Stamp   Beginning download of $QWKPATH$PACKET.QWK ; stamp log
  100. Download Z $QWKPATH$PACKET.QWK          ; start the download
  101. If      $SUCCESS DownloadOK             ; if ok, branch to label
  102. Stamp   Download FAILED                 ; make note in log that it failed
  103. Goto    DoDownload                      ; and do it again
  104.  
  105. ;-----
  106. DownloadOK:                             ; label for OK downloads
  107. Stamp   Download successful             ; make note in log that it was a success
  108. Assign  DDONE Y                         ; change download flag to Y
  109. Goto    CmdLoop                         ; branch back to Command Loop
  110.  
  111. ;-----
  112. DoUpload:                               ; label for upload section
  113. Delay   2000                            ; wait for 2 seconds
  114. Send    "^M"                            ; send ENTER key
  115. Waitfor "TOMCAT MENU"                   ; wait for Tomcat menu prompt
  116. Delay   100                             ; wait .1 second
  117. Exist   $REPPATH$PACKET.REP SendMsgs    ; if there are messages to send then
  118.                                         ; goto SendMsgs
  119. Assign  UDONE Y                         ; if no messages to send, flag that
  120.                                         ; uploading is done
  121. Goto    CmdLoop                         ; and branch back to Command Loop
  122.  
  123. ;-----
  124. SendMsgs:                               ; label for SendMsgs section
  125. Send    "U^M"                           ; send U ENTER
  126. Waitfor "$PACKET.REP"                   ; wait until Tomcat is ready
  127. Pause   1000                            ; wait 1 second
  128. Upload  Z $REPPATH$PACKET.REP           ; start the upload
  129. If      $FAIL DoUpload                  ; if not OK then do it again
  130. DeleteF $REPPATH$PACKET.REP             ; delete the .rep file
  131. If      "$TCLOGOFF" = "Y" AllDoneY      ; if Tomcat set to logoff after upload
  132.                                         ; branch to AllDoneY
  133. Assign  UDONE Y                         ; set upload flag to Y
  134.  
  135. ;-----
  136. AllDoneN:                               ; label when up and downloads are done
  137. When                                    ; cancels all previous When tracking
  138. Send    "^M"                            ; send ENTER
  139. Waitfor "TOMCAT MENU"                   ; wait for menu
  140. Send    "G^M"                           ; send G ENTER to logoff
  141. Goto    EndGame                         ; branch to EndGame label
  142.  
  143. ;-----
  144. AllDoneY:
  145. When                                    ; stop tracking all previous WHENs
  146. When    "Auto Logoff" "H^M"             ; send H ENTER to logoff
  147. Assign  UDONE Y                         ; set the upload done flag
  148.  
  149. ;-----
  150. EndGame:                                ; label for end of script
  151. Hangup                                  ; hangup the modem
  152. Delay   2000                            ; wait 2 seconds
  153. Send    "ATM0H1^M"                      ; take modem offhook
  154. TurnOff Log                             ; close the log file
  155. System  Y                               ; exit back to DOS
  156. Exit                                    ; end of script (if successful)
  157.  
  158. ;-----
  159. TooManyTries:
  160. Stamp   "Mail attempt failed..."        ; place notice in log file
  161. TurnOff Log                             ; close the log file
  162. Exit                                    ; end of script (if failure)
  163.